<!DOCTYPE html>
<html>

<head>
    <script src="angular.js/angular.min.js"></script>
    <script src="js/viewmodel/server_watcher.js"></script>
</head>

<body>
    <div class="row">
        <div class="col-lg-12 col-xl-6">
            <div class="card">
                <div class="card-header">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <h6 class="fs-17 font-weight-600 mb-0">用户管理</h6>
                        </div>                        
                        <div class="text-right">
                            <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#addModal">添加用户</button>
                        </div>
                    </div>
                </div>
                <div class="card-body">
                    <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                        <a style="cursor:pointer" ng-repeat="x in users" ng-class="x.Name!=currentUser.Name ? 'nav-link' : 'nav-link active'" id="v-pills-home-tab" data-toggle="pill" ng-click="toggle(x)" role="tab" aria-controls="v-pills-home" aria-selected="true">
                             {{x.Name}} 密码：
                            <input type="password" class="form-control" placeholder="用户密码" ng-model="x.Password">
                            <button type="button" style="float:right" class="btn btn-success btn-sm" data-toggle="modal" data-target="#saveModal">修改密码</button>
                            <button type="button" style="float:right" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#deleteModal" ng-hide="x.Name==loginUserName">删除</button>
                        </a>
                    </div>                    
                    <div class="modal fade" id="saveModal" tabindex="-1" role="dialog" aria-labelledby="saveModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title" id="saveModalLabel">确认保存？</h4>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="saveUser()">确认</button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div>
                    <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title" id="deleteModalLabel">确认删除？</h4>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="deleteUser()">确认</button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div>
                    <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title" id="addModalLabel">新建用户</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form-group">
                                        <label for="userNameInput" >用户名称</label>
                                        <div class="input-group">
                                            <input type="text" class="form-control" id="userNameInput"
                                                aria-describedby="userNameInput" placeholder="用户名称" ng-model="newUserName">
                                        </div>
                                        <label for="userPasswordInput" >用户密码</label>
                                        <div class="input-group">
                                            <input type="password" class="form-control" id="userPasswordInput"
                                                aria-describedby="userPasswordInput" placeholder="用户密码" ng-model="newUserPassword">
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="addUser()">确认</button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>